/**
 * 日期时间转换工具
 */
 import moment from 'moment';

 const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
 const DATE_FORMAT = 'YYYY-MM-DD';
 const TIME_FORMAT = 'HH:mm:ss';
 
 export function formatToDateTime(
   date = undefined,
   format = DATE_TIME_FORMAT,
 ) {
   return moment(date).format(format);
 }
 
 export function formatToDate(
   date = undefined,
   format = DATE_FORMAT,
 ) {
   return moment(date).format(format);
 }
 
 export function formatToTime(
   date = undefined,
   format = TIME_FORMAT,
 ) {
   return moment(date).format(format);
 }
 
 export const dateUtil = moment;
 